package com.foryou.wechat.controller;

import com.foryou.wechat.service.SysMsgService;
import com.foryou.wechat.utils.HttpContextUtils;
import com.foryou.wechat.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Lee.
 */
@RestController
@RequestMapping("/v/sys/msg")
public class SysMsgController {

    @Autowired
    private SysMsgService sysMsgService;

    @GetMapping("/index")
    public Response getUserMsgInfo() {
        Long userId = HttpContextUtils.getUserId();
        return sysMsgService.getSysMsgIndex(userId);
    }

    @GetMapping("/getSysMsgList")
    public Response getSysMsgList(@RequestParam(defaultValue = "0") int start) {
        return sysMsgService.getSysMsgList(start, HttpContextUtils.getUserId());
    }
}
